A character string constant is a sequence of characters enclosed in double quotes, and represents an array of character values. The last element of the array is the non-printable "null" character: '\0', supplied automatically in string constants. A string constant is treated by C syntactically as the name of a character array, which itself is a pointer to the zeroth element of the array. Thus the following assigns the address of the zeroth element of the string "Hello, world!" to c_ptr:
char *c_ptr;
c_ptr = "Hello, world!";
Now, the elements of the string may be accessed using either array indexing: c_ptr[4], or pointer arithmetic: *(c_ptr+4). It is important to note that the string defined above is a constant value and ANSI C disallows assignments which change it:
c_ptr[4] = 'x'; /* disallowed in this case, since "Hello, world!" is a constant */